
var o__setValue={w:0,h:0,x:50000,y:40000,z:3,d:3,loadType:0,type:0,code:'utf-8',apiSrc:'mapapi_utf8.jsp',apiPath:'http://api.o.cn/',domain:'gz',resourcePath:'/resource/',popStr:'',isLoadMiniMap:true,isLoadZoomBar:true,isLoadHotspot:true,isLoadInfo:true,isLoadAd:true};

//var o__customValue={};
var o__mapStatus=false;
if(typeof(o__customValue)=='undefined'||typeof(o__customValue)!='object')var o__customValue={};
if(typeof(o_x)!='undefined'&&typeof(o_x)=='number') o__customValue.x=o_x;
if(typeof(o_y)!='undefined'&&typeof(o_y)=='number') o__customValue.y=o_y;
if(typeof(o_z)!='undefined'&&typeof(o_z)=='number') o__customValue.z=o_z;
if(typeof(o_mpx)!='undefined'&&typeof(o_mpx)=='number') o__customValue.mpx=o_mpx;
if(typeof(o_mpy)!='undefined'&&typeof(o_mpy)=='number') o__customValue.mpy=o_mpy;
if(typeof(o_msize)!='undefined'&&typeof(o_msize)=='number') o__customValue.msize=o_msize;
if(typeof(o_resourcePath)!='undefined'&&typeof(o_resourcePath)=='string') o__customValue.resourcePath=o_resourcePath;
if(typeof(o_resourcePage)!='undefined'&&typeof(o_resourcePage)=='string') o__customValue.resourcePage=o_resourcePage;
if(typeof(o_mapPath)!='undefined'&&typeof(o_mapPath)=='string') o__customValue.mapPath=o_mapPath;
if(typeof(o_domain)!='undefined'&&typeof(o_domain)=='string') o__customValue.host='http://'+o_domain+'.o.cn';
if(typeof(o_filePath)!='undefined'&&typeof(o_filePath)=='string') o__customValue.filePath=o_filePath;
if(typeof(o_mapid)!='undefined'&&typeof(o_mapid)=='number') o__customValue.mapid=o_mapid;
if(typeof(o_ruler)!='undefined'&&typeof(o_ruler)=='number') o__customValue.ruler=o_ruler;
if(typeof(o_locale)!='undefined'&&typeof(o_locale)=='string') o__customValue.locale=o_locale;
o__customValue.parent=this;

if(navigator.userAgent.toLowerCase().indexOf('msie')>0)
	window.brw='ie';
else if(navigator.userAgent.toLowerCase().indexOf('firefox')>0)
	window.brw='ff';
else 
	window.brw='other';

var o__Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
}

Object.extend = function(dest, source, replace) {
	for(prop in source) {
		if(replace == false && dest[prop] != null) continue;
		dest[prop] = source[prop];
	}
	return dest;
}

var mapDocClass=o__Class.create();
mapDocClass.prototype={
	initialize:function(){
		this.defValue={w:0,h:0,x:50100,y:38900,z:2,d:3,code:'utf-8',apiSrc:'mapapi_utf8.js',apiPath:'',locale:'zh_cn'};
		Object.extend(o__setValue,o__customValue,true);
		Object.extend(this.defValue,o__setValue,true);
		this.mapName='popomap123';
		this.createMap();
	},
	createMap:function(){
		var w,h;
		if(this.defValue.w==0||this.defValue.h==0) 
		{
			w='100%';
			h='100%';
		}
		else
		{
			w=this.defValue.w;
			h=this.defValue.h;
		}
		document.write('<iframe id='+this.mapName+' name='+this.mapName+' width="'+w+'"  height="'+h+'" frameBorder=0 scrolling="no" src="" style="width:'+w+';height:'+h+';position:relative;scrolling:no;z-index:1;"></iframe>');
		this.map=eval(this.mapName);
		with(this.map){			
			document.open();
			document.charset=this.defValue.code;
			document.write('<html xmlns:v="urn:schemas-microsoft-com:vml">');
			document.write('<head>');
			document.write('<style>v\\:*{behavior:url(#default#VML);}</style>');
			//document.write('<link href="http://api.o.cn/inc/css.css" rel="stylesheet" type="text/css">');
			document.write('</head>');
			document.write('<body style="margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;background-color:#cccccc;">');
			document.write('</body>');
			document.write('</html>');
			document.close();

			var jselm=document.createElement('script');
			jselm.language='javascript';
			jselm.id='lang';
			jselm.charset='utf-8';
			jselm.src=this.defValue.apiPath+'/inc/lang/'+this.defValue.locale+'.js';
			document.getElementsByTagName('head')[0].appendChild(jselm);

			var jselm=document.createElement('script');
			jselm.language='javascript';
			jselm.id='mapjs';
			jselm.charset='utf-8';
			jselm.src=this.defValue.apiPath+this.defValue.apiSrc;
			document.body.appendChild(jselm);

			var style=document.createElement('link');
			style.href=this.defValue.apiPath+'/inc/css.css';
			style.rel='stylesheet';
			style.type='text/css';
			style.id='css1';
			document.getElementsByTagName('head')[0].appendChild(style);

			var style=document.createElement('link');
			style.href=this.defValue.apiPath+'/inc/skin3/css.css';
			style.rel='stylesheet';
			style.type='text/css';
			style.id='css1';
			document.getElementsByTagName('head')[0].appendChild(style);

			style=document.createElement('link');
			style.href=this.defValue.apiPath+'/inc/css_'+this.defValue.locale+'.css';
			style.rel='stylesheet';
			style.type='text/css';
			style.id='css2';
			document.getElementsByTagName('head')[0].appendChild(style);
		}
	},
	getMap:function(){
		return this.map;
	},
	getMapStatus:function(){
		return o__mapStatus;
	},
	getCenterX:function(){
		return this.getMap().mapApi.getCenterX();
	},
	getCenterY:function(){
		return this.getMap().mapApi.getCenterY();
	},
	getCurX:function(evt){
		return this.getMap().mapApi.getCurX(evt);
	},
	getCurY:function(evt){
		return this.getMap().mapApi.getCurY(evt);
	},
	getMapWidth:function(){
		return this.getMap().mapApi.mapWidth;
	},
	getMapHeight:function(){
		return this.getMap().mapApi.mapHeight;
	},
	getZoom:function(){
		return this.getMap().mapApi.Zoom;
	},
	getAreaUnitInfo:function(){
		return this.getMap().mapApi.AreaUnitInfo;
	},
	getD:function(type){//
		return this.getMap().mapApi.getD(type);
	},
	getValue:function(name){//
		return this.getMap().mapApi[name];
	},
	invokeFun:function(){//
		return this.getMap().mapApi.invokeFun(arguments);
	},
	drawLine:function(o){//
		return this.getMap().mapApi.drawLine(o);
	},
	mdLine:function(o){//
		return this.getMap().mapApi.mdLine(o);
	},
	mdBusLine:function(o,busLine){//
		return this.getMap().mapApi.mdBusLine(o,busLine);
	},
	go2xy:function(x0,y0,onmove,onend){
		return this.getMap().mapApi.go2xy(x0,y0,onmove,onend);
	},
	go2xyS:function(x0,y0,onmove,onend){
		return this.getMap().mapApi.go2xyS(x0,y0,onmove,onend);
	},
	setValue:function(option,value){
		return this.getMap().mapApi.setOption(option,value);
	},
	setEvent:function(eventType,fun){
		return this.getMap().mapApi.setEvent(eventType,fun);
	},
	setMapTip:function(htmlStr){
		return this.getMap().mapApi.setMapTip(htmlStr);
	},
	setMapCursor:function(c){
		return this.getMap().mapApi.setMapCursor(c);
	},
	selectMode:function(mode){
		return this.getMap().mapApi.selectMode(mode);
	},
	showOCInfo:function(x,y,id,cid,pager,noSlowF){
		return this.getMap().mapApi.showOCInfo(x,y,id,cid,pager,noSlowF);
	},
	drawArea:function(o){//
		return this.getMap().mapApi.drawArea(o);
	},
	drawAllArea:function(){//
		return this.getMap().mapApi.drawAllArea();
	},
	destroyAllG:function(){//
		return this.getMap().mapApi.destroyAllG();
	},
	destroyG:function(item){//
		return this.getMap().mapApi.destroyG(item);
	},
	clrData:function(x,y){//
		return this.getMap().mapApi.clrData(x,y);
	},
	init:function(x,y,l){
		return this.getMap().mapApi.init(x,y,l);
	},
	loadSign:function(type){
		return this.getMap().mapApi.loadSign(type);
	},
	removeSign:function(type){
		return this.getMap().mapApi.removeSign(type);
	},
	changeMapType:function(type){
		return this.getMap().mapApi.changeMapType(type);
	},
	addUserPop:function(arr){
		return this.getMap().mapApi.addUserPop(arr);
	},
	createUserPop:function(e,params){
		return this.getMap().mapApi.createUserPop(e,params);
	},
	createPop:function(idStr,htmlStr,x0,y0,sx,sy,z){
		return this.getMap().mapApi.createPop(idStr,htmlStr,x0,y0,sx,sy,z);
	},
	createPopT:function(idStr,htmlStr,x0,y0,sx,sy,z){
		return this.getMap().mapApi.createPopT(idStr,htmlStr,x0,y0,sx,sy,z);
	},
	zoomto:function(z){
		return this.getMap().mapApi.zoomto(z);
	},
	removePop:function(id){
		return this.getMap().mapApi.removePop(id);
	},
	removeAllPop:function(){
		return this.getMap().mapApi.removeAllPop();
	},
	setWidth:function(w){
		document.getElementById(this.mapName).style.width=w;
	},
	setHeight:function(h){
		document.getElementById(this.mapName).style.height=h;
	}
}
var popomap=new mapDocClass();

